# use pkg-config for getting CFLAGS and LDFLAGS
GST_LIBS = gstreamer-0.10
EXIST = $(shell pkg-config --exists $(GST_LIBS); echo $$? )
LDFLAGS += $(shell pkg-config --libs $(GST_LIBS))
CFLAGS += $(shell pkg-config  --cflags $(GST_LIBS))

EXTRA_DIST = gstreamer.c

all-local: gstreamer.so

gstreamer.so: gstreamer.c
	@if [ $(EXIST) -eq 0 ]; \
	then \
		$(CC) $< -o $@ $(CFLAGS) $(INCLUDES) $(LDFLAGS) -shared -fPIC; \
	else \
		echo "!!!  these libraries does not exist :: $(GST_LIBS)  !!!"; \
	fi
	
install-exec-local:
	@-if [ $(EXIST) -eq 0 ]; \
	then \
		mkdir -p $(LIB_OUTPUT_DIR); \
		sudo cp -f gstreamer.so $(LIB_OUTPUT_DIR); \
	else \
		echo "!!!  these libraries does not exist :: $(GST_LIBS)  !!!"; \
	fi
	
uninstall-local:
	@-if [ $(EXIST) -eq 0 ]; \
	then \
		sudo rm $(LIB_OUTPUT_DIR)/gstreamer.so; \
	else \
		echo "!!!  these libraries does not exist :: $(GST_LIBS)  !!!"; \
	fi

clean-local:
	@-if [ $(EXIST) -eq 0 ]; \
	then \
		rm gstreamer.so; \
	else \
		echo "!!!  these libraries does not exist :: $(GST_LIBS)  !!!"; \
	fi
